Beispiel #1
0
 def password_reset_confirmation(self):
     if request.GET and request.GET.get('key'):
         try:
             user = User.get_by_api_key(request.GET.get('key'))
             data = dict(email=user.email)
             UserModel().reset_password(data)
             h.flash(_('Your password reset was successful, '
                       'new password has been sent to your email'),
                         category='success')
         except Exception, e:
             log.error(e)
             return redirect(url('reset_password'))
Beispiel #2
0
 def password_reset_confirmation(self):
     if request.GET and request.GET.get('key'):
         try:
             user = User.get_by_api_key(request.GET.get('key'))
             data = dict(email=user.email)
             UserModel().reset_password(data)
             h.flash(_('Your password reset was successful, '
                       'new password has been sent to your email'),
                         category='success')
         except Exception, e:
             log.error(e)
             return redirect(url('reset_password'))
Beispiel #3
0
    def password_reset_confirmation(self):

        if request.GET and request.GET.get("key"):
            try:
                user_model = UserModel()
                user = User.get_by_api_key(request.GET.get("key"))
                data = dict(email=user.email)
                user_model.reset_password(data)
                h.flash(
                    _("Your password reset was successful, " "new password has been sent to your email"),
                    category="success",
                )
            except Exception, e:
                log.error(e)
                return redirect(url("reset_password"))
Beispiel #4
0
 def get_by_api_key(self, api_key, cache=False):
     return User.get_by_api_key(api_key, cache)
Beispiel #5
0
            # catch JSON errors Here
            return jsonrpc_error(message="JSON parse error ERR:%s RAW:%r" % (e, urllib.unquote_plus(raw_body)))

        # check AUTH based on API KEY
        try:
            self._req_api_key = json_body["api_key"]
            self._req_id = json_body["id"]
            self._req_method = json_body["method"]
            self._request_params = json_body["args"]
            log.debug("method: %s, params: %s", self._req_method, self._request_params)
        except KeyError, e:
            return jsonrpc_error(message="Incorrect JSON query missing %s" % e)

        # check if we can find this session using api_key
        try:
            u = User.get_by_api_key(self._req_api_key)
            if u is None:
                return jsonrpc_error(message="Invalid API KEY")
            auth_u = AuthUser(u.user_id, self._req_api_key)
        except Exception, e:
            return jsonrpc_error(message="Invalid API KEY")

        self._error = None
        try:
            self._func = self._find_method()
        except AttributeError, e:
            return jsonrpc_error(message=str(e))

        # now that we have a method, add self._req_params to
        # self.kargs and dispatch control to WGIController
        argspec = inspect.getargspec(self._func)
Beispiel #6
0
 def get_by_api_key(self, api_key, cache=False):
     return User.get_by_api_key(api_key, cache)
Beispiel #7
0
                                 % (e, urllib.unquote_plus(raw_body)))

        # check AUTH based on API KEY
        try:
            self._req_api_key = json_body['api_key']
            self._req_id = json_body['id']
            self._req_method = json_body['method']
            self._request_params = json_body['args']
            log.debug('method: %s, params: %s' %
                      (self._req_method, self._request_params))
        except KeyError, e:
            return jsonrpc_error(message='Incorrect JSON query missing %s' % e)

        # check if we can find this session using api_key
        try:
            u = User.get_by_api_key(self._req_api_key)
            if u is None:
                return jsonrpc_error(message='Invalid API KEY')
            auth_u = AuthUser(u.user_id, self._req_api_key)
        except Exception, e:
            return jsonrpc_error(message='Invalid API KEY')

        self._error = None
        try:
            self._func = self._find_method()
        except AttributeError, e:
            return jsonrpc_error(message=str(e))

        # now that we have a method, add self._req_params to
        # self.kargs and dispatch control to WGIController
        argspec = inspect.getargspec(self._func)