Mercurial > pidgin
comparison libpurple/protocols/mxit/login.c @ 30097:da8c00c5b4e5
Specify purple_request_field_set_required() for the Capcha input textbox.
(This resolves an issue with Pidgin on Maemo where the MXit account cannot be activated)
Also set the Birthdate, NickName, PIN1 & PIN2 as required fields when registering.
It provides better UI-feedback to the user.
author | andrew.victor@mxit.com |
---|---|
date | Tue, 25 May 2010 21:08:25 +0000 |
parents | 085020c013eb |
children | d7325448badb |
comparison
equal
deleted
inserted
replaced
30010:1518b6b70556 | 30097:da8c00c5b4e5 |
---|---|
331 /* mxit login name */ | 331 /* mxit login name */ |
332 field = purple_request_field_string_new( "loginname", _( "MXit Login Name" ), purple_account_get_username( session->acc ), FALSE ); | 332 field = purple_request_field_string_new( "loginname", _( "MXit Login Name" ), purple_account_get_username( session->acc ), FALSE ); |
333 purple_request_field_string_set_editable( field, FALSE ); | 333 purple_request_field_string_set_editable( field, FALSE ); |
334 purple_request_field_group_add_field( group, field ); | 334 purple_request_field_group_add_field( group, field ); |
335 | 335 |
336 /* nick name */ | 336 /* nick name (required) */ |
337 field = purple_request_field_string_new( "nickname", _( "Nick Name" ), profile->nickname, FALSE ); | 337 field = purple_request_field_string_new( "nickname", _( "Nick Name" ), profile->nickname, FALSE ); |
338 purple_request_field_group_add_field( group, field ); | 338 purple_request_field_set_required( field, TRUE ); |
339 | 339 purple_request_field_group_add_field( group, field ); |
340 /* birthday */ | 340 |
341 /* birthday (required) */ | |
341 field = purple_request_field_string_new( "bday", _( "Birthday" ), profile->birthday, FALSE ); | 342 field = purple_request_field_string_new( "bday", _( "Birthday" ), profile->birthday, FALSE ); |
342 purple_request_field_string_set_default_value( field, "YYYY-MM-DD" ); | 343 purple_request_field_string_set_default_value( field, "YYYY-MM-DD" ); |
344 purple_request_field_set_required( field, TRUE ); | |
343 purple_request_field_group_add_field( group, field ); | 345 purple_request_field_group_add_field( group, field ); |
344 | 346 |
345 /* gender */ | 347 /* gender */ |
346 field = purple_request_field_choice_new( "male", _( "Gender" ), ( profile->male ) ? 1 : 0 ); | 348 field = purple_request_field_choice_new( "male", _( "Gender" ), ( profile->male ) ? 1 : 0 ); |
347 purple_request_field_choice_add( field, _( "Female" ) ); /* 0 */ | 349 purple_request_field_choice_add( field, _( "Female" ) ); /* 0 */ |
348 purple_request_field_choice_add( field, _( "Male" ) ); /* 1 */ | 350 purple_request_field_choice_add( field, _( "Male" ) ); /* 1 */ |
349 purple_request_field_group_add_field( group, field ); | 351 purple_request_field_group_add_field( group, field ); |
350 | 352 |
351 /* pin */ | 353 /* pin (required) */ |
352 field = purple_request_field_string_new( "pin", _( "PIN" ), profile->pin, FALSE ); | 354 field = purple_request_field_string_new( "pin", _( "PIN" ), profile->pin, FALSE ); |
353 purple_request_field_string_set_masked( field, TRUE ); | 355 purple_request_field_string_set_masked( field, TRUE ); |
356 purple_request_field_set_required( field, TRUE ); | |
354 purple_request_field_group_add_field( group, field ); | 357 purple_request_field_group_add_field( group, field ); |
355 field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), "", FALSE ); | 358 field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), "", FALSE ); |
356 purple_request_field_string_set_masked( field, TRUE ); | 359 purple_request_field_string_set_masked( field, TRUE ); |
360 purple_request_field_set_required( field, TRUE ); | |
357 purple_request_field_group_add_field( group, field ); | 361 purple_request_field_group_add_field( group, field ); |
358 | 362 |
359 /* show the form to the user to complete */ | 363 /* show the form to the user to complete */ |
360 purple_request_fields( session->con, _( "Register New MXit Account" ), _( "Register New MXit Account" ), _( "Please fill in the following fields:" ), fields, _( "OK" ), G_CALLBACK( mxit_cb_register_ok ), _( "Cancel" ), G_CALLBACK( mxit_cb_register_cancel ), session->acc, NULL, NULL, session->con ); | 364 purple_request_fields( session->con, _( "Register New MXit Account" ), _( "Register New MXit Account" ), _( "Please fill in the following fields:" ), fields, _( "OK" ), G_CALLBACK( mxit_cb_register_ok ), _( "Cancel" ), G_CALLBACK( mxit_cb_register_cancel ), session->acc, NULL, NULL, session->con ); |
361 } | 365 } |
634 /* add the captcha */ | 638 /* add the captcha */ |
635 logindata->captcha = purple_base64_decode( parts[3], &logindata->captcha_size ); | 639 logindata->captcha = purple_base64_decode( parts[3], &logindata->captcha_size ); |
636 field = purple_request_field_image_new( "capcha", _( "Security Code" ), (gchar*) logindata->captcha, logindata->captcha_size ); | 640 field = purple_request_field_image_new( "capcha", _( "Security Code" ), (gchar*) logindata->captcha, logindata->captcha_size ); |
637 purple_request_field_group_add_field( group, field ); | 641 purple_request_field_group_add_field( group, field ); |
638 | 642 |
639 /* ask for input */ | 643 /* ask for input (required) */ |
640 field = purple_request_field_string_new( "code", _( "Enter Security Code" ), NULL, FALSE ); | 644 field = purple_request_field_string_new( "code", _( "Enter Security Code" ), NULL, FALSE ); |
645 purple_request_field_set_required( field, TRUE ); | |
641 purple_request_field_group_add_field( group, field ); | 646 purple_request_field_group_add_field( group, field ); |
642 | 647 |
643 /* choose your country, but be careful, we already know your IP! ;-) */ | 648 /* choose your country, but be careful, we already know your IP! ;-) */ |
644 countries = g_strsplit( parts[4], ",", 500 ); | 649 countries = g_strsplit( parts[4], ",", 500 ); |
645 field = purple_request_field_list_new( "country", _( "Your Country" ) ); | 650 field = purple_request_field_list_new( "country", _( "Your Country" ) ); |