Page 31 -
P. 31

그림 37-2 가입 절차












                                var userInfo = { username , email , password , profile : { name } };
                              1  Accounts.createUser(userInfo,function(error){
                                   if(!!error){
                                       alert(error.reason);
                  ௿ۄ੉঱౟            }else{
                                      alert("가입성공");
                                      $(tmpl.findAll('input')).val("");
                                   }                                        2  VTFSOBNF  FNBJM
                                                                              ਬੌࢿ Ѩࢎ
                                });
                                         3  Accounts.onCreateUser(function(options, user) {
                                              user.profile = options.profile;
                                              user.profile.isAdmin = false;
                                              return user;
                                          });


                  ࢲߡز੘   _               4  Accounts.validateNewUser(function (user) {
                                              if (user.username && user.username.length >= 3){
                                                 return true;
                                              } else {
                                                 throw new Meteor.Error(403, "사용자 명은 3자 이상");
                                              }
                                          });




                  37.3          로그인/로그아웃 구현                                    METEOR






                  로그인 화면 구현은 customLogIn 템플릿을 작성하여 구현한다.







            554
   26   27   28   29   30   31   32   33