Annet, as I state in my previous post, I had tried your approach
before first posting this thread and discovered it didn't work for
exactly the reasons that hamdy lists.
Massimo, thanks for the response, too. Looks like you are suggesting
exactly hamdy's solution, which I have implemented, and it
on the ideal case , most people don't force login_url
because suppose for example, you've a login form above in the banner
of your web app
and when user stands in a specific page and enters his user/pass in
login form , ...you don't want him to leave the current page right?
moreover your web site
Hi annet
Saying it's useless I meant that setting the message after logging
in , I didn't mean to be mean at all, sorry that you misunderstood
me :)
Now let's rethink you solution :
It will work right ? but when ?
it will work if you just in the index page made something like:
def index():
> This's not working !! you need to set the message before actually logged in !!
Why is that? I welcome a user who logs in so setting
auth.messages.logged_in works. When does auth.user provide you with
values for first_name and last_name in your solution? Before logging
in?
> your solution just
def set_welcome(form):
session.flash=T('hello %(name)s',
dict(name=auth.user.first_name))
auth.settings.login_onaccept=set_welcome
On Jun 3, 5:22 am, "hamdy.a.farag" wrote:
> This's not working !!
>
> you need to set the message before actually logged in !!
> your solution just set the mess
This's not working !!
you need to set the message before actually logged in !!
your solution just set the message after user is actually logged in so
it's useless
moreover, setting the logout message will not work, unless the index
page itself has no flash message set
or else the flash message in
Curious - I tried something like this earlier and had trouble with it.
For now, I like hamdy's solution.
On Jun 3, 4:33 am, annet wrote:
> It's probably not the most elegant of solutions, but in db.py I simply
> set:
>
> if auth.is_logged_in():
> auth.messages.logged_in='Logged in successfull
It's probably not the most elegant of solutions, but in db.py I simply
set:
if auth.is_logged_in():
auth.messages.logged_in='Logged in successfully, welcome ' +
auth.user.first_name + ' ' + auth.user.last_name
auth.messages.logged_out='Logged out successfully, until next time
' + auth.use
On Jun 2, 1:52 pm, weheh wrote:
> @hamdy.a.farag: swet. One of these days I have to memorize the
> bazillion or so auth.settings.
or simply use an IDE / debugger which will do completions for
you!
>
> On Jun 2, 12:53 pm, "hamdy.a.farag" wrote:
>
> > in your model add something like
>
@hamdy.a.farag: swet. One of these days I have to memorize the
bazillion or so auth.settings.
On Jun 2, 12:53 pm, "hamdy.a.farag" wrote:
> in your model add something like
>
> def set_message(form):
> session.flash = T('hello %(name)s', dict(name=auth.user and
> auth.user.first_name))
>
>
in your model add something like
def set_message(form):
session.flash = T('hello %(name)s', dict(name=auth.user and
auth.user.first_name))
auth.settings.login_onaccept = set_message
hmmm. let me think about it.
On Jun 2, 2:04 am, weheh wrote:
> I suppose there's no easy way to get your login message to say
> something like this:
>
> auth.messages.logged_in=T('Welcome ')+auth.user.username
>
> Without fully customizing the login controller. Right?
>
> Same goes for logout.
12 matches
Mail list logo