레이아웃에서 로그인 폼을 박아넣는 작업을 하고 있습니다.
레이아웃에 아래 코드를 넣으면 로그인 폼이 나타납니다.
<form action="{getUrl()}" method="post" ruleset="@login" class="form" id="fo_login_member">
<input type="hidden" name="act" value="procMemberLogin" />
<input type="hidden" name="success_return_url" value="{htmlspecialchars(getRequestUriByServerEnviroment(), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE)}" />
<p class="fieldset">
<label class="image-replace email" for="signin-email">E-mail</label>
<!--@if($id)-->
<input class="full-width has-padding has-border" id="signin-email" type="id" placeholder="E-mail" name="user_id">
<!--@else-->
<input class="full-width has-padding has-border" id="signin-email" type="email" placeholder="E-mail" name="user_id">
<!--@end-->
<span class="error-message">An account with this email address does not exist!</span>
</p>
<p class="fieldset">
<label class="image-replace password" for="signin-password">Password</label>
<input class="full-width has-padding has-border" id="signin-password" type="password" placeholder="Password" name="password">
<a href="#0" class="hide-password">Show</a>
<span class="error-message">Wrong password! Try again.</span>
</p>
<div class="g-recaptcha" id="optional-id"></div>
<p class="fieldset">
<input type="checkbox" id="remember-me" checked>
<label for="remember-me">Remember me</label>
</p>
<p class="fieldset">
<input class="full-width" type="submit" value="Login">
<!--<button type="submit" class="g-recaptcha full-width has-padding"-->
<!--data-sitekey="6LeR7z0UAAAAAKJ0-KIU0ZF2klUocET1kd8lheYy"-->
<!--data-callback="recaptcha_callback_signin">-->
<!--Login-->
<!--</button>-->
</p>
</form>
여기서 안 풀린게 로그인 방식이 아이디인지, 이메일인지, 라이믹스에서는 전화번호까지 추가되었더군요.
라이믹스에서는 이게 중복으로 다 되기도 하고요.
{@ //$oModuleModel = getModel('member'); //$args = new stdClass(); $oMemberModel = getModel('member'); $config = $oMemberModel->getMemberConfig(); $oModuleController = getController('module'); } {var_dump($config)}
이렇게 레이아웃에 넣어주게 되면, 아래 코드를 확인할 수 있습니다.
object(stdClass)#30 (56) { ["signupForm"]=> array(13) { [0]=> object(stdClass)#33 (9) { ["isIdentifier"]=> bool(true) ["isDefaultForm"]=> bool(true) ["name"]=> string(13) "email_address" ["title"]=> string(16) "이메일 주소" ["mustRequired"]=> bool(true) ["imageType"]=> bool(false) ["required"]=> bool(true) ["isUse"]=> bool(true) ["isPublic"]=> string(1) "N" } [1]=> object(stdClass)#32 (9) { ["isIdentifier"]=> bool(true) ["isDefaultForm"]=> bool(true) ["name"]=> string(12) "phone_number" ["title"]=> string(12) "전화번호" ["mustRequired"]=> bool(false) ["imageType"]=> bool(false) ["required"]=> bool(false) ["isUse"]=> bool(false) ["isPublic"]=> string(1) "N" } [2]=> object(stdClass)#31 (9) { ["isIdentifier"]=> bool(true) ["isDefaultForm"]=> bool(true) ["name"]=> string(7) "user_id" ["title"]=> string(9) "아이디" ["mustRequired"]=> bool(false) ["imageType"]=> bool(false) ["required"]=> bool(true) ["isUse"]=> bool(true) ["isPublic"]=> string(1) "Y" } [3]=> object(stdClass)#38 (9) { ["isIdentifier"]=> bool(false) ["isDefaultForm"]=> bool(true) ["name"]=> string(8) "password" ["title"]=> string(12) "비밀번호" ["mustRequired"]=> bool(true) ["imageType"]=> bool(false) ["required"]=> bool(true) ["isUse"]=> bool(true) ["isPublic"]=> string(1) "N" } [4]=> object(stdClass)#39 (9) { ["isIdentifier"]=> bool(false) ["isDefaultForm"]=> bool(true) ["name"]=> string(9) "user_name" ["title"]=> string(6) "이름" ["mustRequired"]=> bool(false) ["imageType"]=> bool(false) ["required"]=> bool(true) ["isUse"]=> bool(true) ["isPublic"]=> string(1) "Y" } [5]=> object(stdClass)#40 (9) { ["isIdentifier"]=> bool(false) ["isDefaultForm"]=> bool(true) ["name"]=> string(9) "nick_name" ["title"]=> string(9) "닉네임" ["mustRequired"]=> bool(true) ["imageType"]=> bool(false) ["required"]=> bool(true) ["isUse"]=> bool(true) ["isPublic"]=> string(1) "Y" } [6]=> object(stdClass)#41 (9) { ["isIdentifier"]=> bool(false) ["isDefaultForm"]=> bool(true) ["name"]=> string(8) "homepage" ["title"]=> string(12) "홈페이지" ["mustRequired"]=> bool(false) ["imageType"]=> bool(false) ["required"]=> bool(false) ["isUse"]=> bool(true) ["isPublic"]=> string(1) "Y" } [7]=> object(stdClass)#42 (9) { ["isIdentifier"]=> bool(false) ["isDefaultForm"]=> bool(true) ["name"]=> string(4) "blog" ["title"]=> string(9) "블로그" ["mustRequired"]=> bool(false) ["imageType"]=> bool(false) ["required"]=> bool(false) ["isUse"]=> bool(true) ["isPublic"]=> string(1) "Y" } [8]=> object(stdClass)#43 (9) { ["isIdentifier"]=> bool(false) ["isDefaultForm"]=> bool(true) ["name"]=> string(8) "birthday" ["title"]=> string(6) "생일" ["mustRequired"]=> bool(false) ["imageType"]=> bool(false) ["required"]=> bool(false) ["isUse"]=> bool(true) ["isPublic"]=> string(1) "Y" } [9]=> object(stdClass)#44 (9) { ["isIdentifier"]=> bool(false) ["isDefaultForm"]=> bool(true) ["name"]=> string(9) "signature" ["title"]=> string(6) "서명" ["mustRequired"]=> bool(false) ["imageType"]=> bool(false) ["required"]=> bool(false) ["isUse"]=> bool(false) ["isPublic"]=> string(1) "N" } [10]=> object(stdClass)#45 (12) { ["isIdentifier"]=> bool(false) ["isDefaultForm"]=> bool(true) ["name"]=> string(13) "profile_image" ["title"]=> string(16) "프로필 사진" ["mustRequired"]=> bool(false) ["imageType"]=> bool(true) ["required"]=> bool(false) ["isUse"]=> bool(true) ["isPublic"]=> string(1) "Y" ["max_width"]=> NULL ["max_height"]=> NULL ["max_filesize"]=> NULL } [11]=> object(stdClass)#46 (12) { ["isIdentifier"]=> bool(false) ["isDefaultForm"]=> bool(true) ["name"]=> string(10) "image_name" ["title"]=> string(16) "이미지 이름" ["mustRequired"]=> bool(false) ["imageType"]=> bool(true) ["required"]=> bool(false) ["isUse"]=> bool(false) ["isPublic"]=> string(1) "N" ["max_width"]=> NULL ["max_height"]=> NULL ["max_filesize"]=> NULL } [12]=> object(stdClass)#47 (12) { ["isIdentifier"]=> bool(false) ["isDefaultForm"]=> bool(true) ["name"]=> string(10) "image_mark" ["title"]=> string(16) "이미지 마크" ["mustRequired"]=> bool(false) ["imageType"]=> bool(true) ["required"]=> bool(false) ["isUse"]=> bool(false) ["isPublic"]=> string(1) "N" ["max_width"]=> NULL ["max_height"]=> NULL ["max_filesize"]=> NULL } } ["agreement"]=> NULL ["agreements"]=> array(1) { [1]=> object(stdClass)#48 (3) { ["title"]=> string(20) "회원 가입 약관" ["content"]=> NULL ["type"]=> string(8) "disabled" } } ["webmaster_name"]=> string(9) "webmaster" ["image_name_max_width"]=> int(90) ["image_name_max_height"]=> int(20) ["image_name_max_filesize"]=> NULL ["image_mark_max_width"]=> int(20) ["image_mark_max_height"]=> int(20) ["image_mark_max_filesize"]=> NULL ["profile_image_max_width"]=> int(90) ["profile_image_max_height"]=> int(90) ["profile_image_max_filesize"]=> NULL ["skin"]=> string(24) "comely_member_eondcustom" ["colorset"]=> string(5) "white" ["editor_skin"]=> string(8) "ckeditor" ["group_image_mark"]=> string(1) "N" ["identifier"]=> string(7) "user_id" ["emailhost_check"]=> string(7) "allowed" ["max_error_count"]=> string(2) "10" ["max_error_count_time"]=> string(3) "300" ["signature_editor_skin"]=> string(8) "ckeditor" ["sel_editor_colorset"]=> string(10) "moono-lisa" ["member_allow_fileupload"]=> string(1) "N" ["member_profile_view"]=> string(1) "N" ["enable_join"]=> string(1) "Y" ["enable_openid"]=> string(1) "N" ["enable_auth_mail"]=> string(1) "N" ["image_name"]=> string(1) "N" ["image_mark"]=> string(1) "N" ["profile_image"]=> string(1) "Y" ["authmail_expires"]=> int(3) ["authmail_expires_unit"]=> int(86400) ["password_strength"]=> string(6) "normal" ["password_hashing_algorithm"]=> string(6) "bcrypt" ["password_hashing_work_factor"]=> int(10) ["password_hashing_auto_upgrade"]=> string(1) "Y" ["limit_day"]=> int(0) ["limit_day_description"]=> NULL ["redirect_url"]=> NULL ["phone_number_default_country"]=> string(3) "KOR" ["phone_number_hide_country"]=> string(1) "N" ["phone_number_allow_duplicate"]=> string(1) "N" ["phone_number_verify_by_sms"]=> string(1) "N" ["signature_html"]=> string(1) "Y" ["signature_html_retroact"]=> NULL ["signature"]=> string(1) "N" ["layout_srl"]=> int(-1) ["mlayout_srl"]=> int(-2) ["mskin"]=> string(13) "comely_member" ["identifiers"]=> array(3) { [0]=> string(7) "user_id" [1]=> string(13) "email_address" [2]=> string(12) "phone_number" } ["change_password_date"]=> int(0) ["enable_login_fail_report"]=> string(1) "Y" ["login_invalidate_other_sessions"]=> string(1) "N" ["after_login_url"]=> NULL ["after_logout_url"]=> NULL }
여기서 필요한 부분은 바로 이 부분입니다.
["identifiers"]=> array(3) { [0]=> string(7) "user_id" [1]=> string(13) "email_address" [2]=> string(12) "phone_number"
제가 원하는 건 이렇게 확인이 됩니다.
{@ $oMemberModel = getModel('member'); $config = $oMemberModel->getMemberConfig(); } {var_dump($config->identifiers)} {var_dump($config->identifiers[0]=='user_id')} {var_dump($config->identifiers[1]=='email_address')} {var_dump($config->identifiers[2]=='phone_number')}
이걸 이제 넣어보면
{@ $oMemberModel = getModel('member'); $config = $oMemberModel->getMemberConfig(); //$id = $config->identifiers[0]=='user_id'; //$email = $config->identifiers[1]=='email_address'; $id = in_array('user_id',$config->identifiers); $email = in_array('email_address',$config->identifiers) } <form action="{getUrl()}" method="post" ruleset="@login" class="form" id="fo_login_member"> <input type="hidden" name="act" value="procMemberLogin" /> <input type="hidden" name="success_return_url" value="{htmlspecialchars(getRequestUriByServerEnviroment(), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE)}" /> <p class="fieldset"> <!--@if($id=='true')--> <label class="image-replace email" for="signin-email">아이디</label> <input class="full-width has-padding has-border" id="signin-email" type="id" placeholder="E-mail" name="user_id"> <!--@elseif($email=='true')--> <label class="image-replace email" for="signin-email">E-mail</label> 이메일 <input type="text"> <input class="full-width has-padding has-border" id="signin-email" type="email" placeholder="E-mail" name="user_id"> <!--@end--> <!-- <span class="error-message">An account with this email address does not exist!</span>--> </p> <p class="fieldset"> <label class="image-replace password" for="signin-password">Password</label> <input class="full-width has-padding has-border" id="signin-password" type="password" placeholder="Password" name="password"> <a href="#0" class="hide-password">Show</a> <span class="error-message">Wrong password! Try again.</span> </p> <div class="g-recaptcha" id="optional-id"></div> <p class="fieldset"> <input type="checkbox" id="remember-me" checked> <label for="remember-me">Remember me</label> </p> <p class="fieldset"> <input class="full-width" type="submit" value="Login"> <!--<button type="submit" class="g-recaptcha full-width has-padding"--> <!--data-sitekey="6LeR7z0UAAAAAKJ0-KIU0ZF2klUocET1kd8lheYy"--> <!--data-callback="recaptcha_callback_signin">--> <!--Login--> <!--</button>--> </p> </form>
$oMemberModel = getModel('member');
$config = $oMemberModel->getMemberConfig();
//$id = $config->identifiers[0]=='user_id';
//$email = $config->identifiers[1]=='email_address';
$id = in_array('user_id',$config->identifiers);
$email = in_array('email_address',$config->identifiers)
이 부분을 보시면, 해당 값은 배열로 되어있어 늘 순서대로 되진 않겠죠?;
아이디를 체크하면 아이디가 0, 이메일이 1이 되지만
아이디를 체크하지 않고 이메일만 체크하면 이메일이 0이 됩니다.
그래서 배열로 체크해서 넣어주면 됩니다.