Exemplo n.º 1
0
    def post(self):

        form = ResetPasswordForm(self)

        if form.validate():
            user = self.current_user
            enc_password = enc_login_passwd(form.password.data)
            user.password = enc_password

            root_passwd = enc_shadow_passwd(form.password.data)
            user.profile.set_secret('root_shadow_passwd', root_passwd)
            self.db2.commit()

            url = self.application.reverse_url('account:index')
            return self.redirect( url )

        self.render( 'account/reset_password.html', title = self.trans(_('Reset Password')),
                     form = form )
Exemplo n.º 2
0
    def post_reset_password(self):

        form = ResetPasswordForm(self)

        if form.validate():

            salt = md5(str(random.random())).hexdigest()[:12]
            hsh = encrypt_password(salt, form.password.data)
            enc_password = "******" % (salt, hsh)

            self.user.password = enc_password
            self.db2.commit()

            url = self.reverse_url('admin:user')
            url += '?id=%s&action=view' % self.user.id
            return self.redirect( url )

        self.render( 'admin/user/reset_password.html', title = self.trans(_('Reset Password')),
                     form = form, U = self.user )
Exemplo n.º 3
0
    def post(self):

        form = ResetPasswordForm(self.request.arguments)

        if form.validate():

            salt = md5(str(random.random())).hexdigest()[:12]
            hsh = encrypt_password(salt, form.password.data)
            enc_password = "******" % (salt, hsh)

            user = self.db2.query(User).get( self.current_user.id )
            user.password = enc_password
            self.db2.commit()

            url = self.application.reverse_url('account:index')
            return self.redirect( url )

        self.render( 'account/reset_password.html', title = _('Reset Password'),
                     form = form )
Exemplo n.º 4
0
    def post_reset_password(self):

        form = ResetPasswordForm(self.request.arguments)

        if form.validate():

            salt = md5(str(random.random())).hexdigest()[:12]
            hsh = encrypt_password(salt, form.password.data)
            enc_password = "******" % (salt, hsh)

            self.user.password = enc_password
            self.db2.commit()

            url = self.reverse_url('admin:user')
            url += '?id=%s&action=view' % self.user.id
            return self.redirect(url)

        self.render('admin/user/reset_password.html',
                    title=_('Reset Password'),
                    form=form,
                    USER=self.user)