def test_my_account_my_emails_add_remove(self): self.log_user() response = self.app.get(url('my_account_emails')) response.mustcontain('No additional emails specified') response = self.app.post(url('my_account_emails'), {'new_email': '*****@*****.**'}) response = self.app.get(url('my_account_emails')) from kallithea.model.db import UserEmailMap email_id = UserEmailMap.query()\ .filter(UserEmailMap.user == User.get_by_username(TEST_USER_ADMIN_LOGIN))\ .filter(UserEmailMap.email == '*****@*****.**').one().email_id response.mustcontain('*****@*****.**') response.mustcontain( '<input id="del_email_id" name="del_email_id" type="hidden" value="%s" />' % email_id) response = self.app.post(url('my_account_emails'), { 'del_email_id': email_id, '_method': 'delete' }) self.checkSessionFlash(response, 'Removed email from user') response = self.app.get(url('my_account_emails')) response.mustcontain('No additional emails specified')
def my_account_emails(self): c.active = 'emails' self.__load_data() c.user_email_map = UserEmailMap.query()\ .filter(UserEmailMap.user == c.user).all() return render('admin/my_account/my_account.html')
def my_account_emails(self): c.active = 'emails' self.__load_data() c.user_email_map = UserEmailMap.query() \ .filter(UserEmailMap.user == c.user).all() return render('admin/my_account/my_account.html')
def delete_extra_email(self, user, email_id): """ Removes email address from UserEmailMap :param user: :param email_id: """ user = User.guess_instance(user) obj = UserEmailMap.query().get(email_id) if obj is not None: Session().delete(obj)
def delete_extra_email(self, user, email_id): """ Removes email address from UserEmailMap :param user: :param email_id: """ user = self._get_user(user) obj = UserEmailMap.query().get(email_id) if obj: self.sa.delete(obj)
def delete_extra_email(self, user, email_id): """ Removes email address from UserEmailMap :param user: :param email_id: """ user = User.guess_instance(user) obj = UserEmailMap.query().get(email_id) if obj is not None: Session().delete(obj)
def edit_emails(self, id): c.user = self._get_user_or_raise_if_default(id) c.active = 'emails' c.user_email_map = UserEmailMap.query() \ .filter(UserEmailMap.user == c.user).all() defaults = c.user.get_dict() return htmlfill.render( render('admin/users/user_edit.html'), defaults=defaults, encoding="UTF-8", force_defaults=False)
def edit_emails(self, id): c.user = self._get_user_or_raise_if_default(id) c.active = 'emails' c.user_email_map = UserEmailMap.query() \ .filter(UserEmailMap.user == c.user).all() defaults = c.user.get_dict() return htmlfill.render( render('admin/users/user_edit.html'), defaults=defaults, encoding="UTF-8", force_defaults=False)
def edit_emails(self, id): c.user = User.get_or_404(id) if c.user.username == User.DEFAULT_USER: h.flash(_("You can't edit this user"), category='warning') return redirect(url('users')) c.active = 'emails' c.user_email_map = UserEmailMap.query()\ .filter(UserEmailMap.user == c.user).all() defaults = c.user.get_dict() return htmlfill.render(render('admin/users/user_edit.html'), defaults=defaults, encoding="UTF-8", force_defaults=False)
def edit_emails(self, id): c.user = User.get_or_404(id) if c.user.username == User.DEFAULT_USER: h.flash(_("You can't edit this user"), category='warning') return redirect(url('users')) c.active = 'emails' c.user_email_map = UserEmailMap.query()\ .filter(UserEmailMap.user == c.user).all() defaults = c.user.get_dict() return htmlfill.render( render('admin/users/user_edit.html'), defaults=defaults, encoding="UTF-8", force_defaults=False)
def test_my_account_my_emails_add_remove(self): self.log_user() response = self.app.get(url('my_account_emails')) response.mustcontain('No additional emails specified') response = self.app.post(url('my_account_emails'), {'new_email': '*****@*****.**', '_authentication_token': self.authentication_token()}) response = self.app.get(url('my_account_emails')) from kallithea.model.db import UserEmailMap email_id = UserEmailMap.query() \ .filter(UserEmailMap.user == User.get_by_username(TEST_USER_ADMIN_LOGIN)) \ .filter(UserEmailMap.email == '*****@*****.**').one().email_id response.mustcontain('*****@*****.**') response.mustcontain('<input id="del_email_id" name="del_email_id" type="hidden" value="%s" />' % email_id) response = self.app.post(url('my_account_emails_delete'), {'del_email_id': email_id, '_authentication_token': self.authentication_token()}) self.checkSessionFlash(response, 'Removed email from user') response = self.app.get(url('my_account_emails')) response.mustcontain('No additional emails specified')