Commit 1ba34442 authored by Nicolas Jager's avatar Nicolas Jager
Browse files

fix : wizzard create account with good credentials

Change-Id: Ie64dd640cea11876575e3e9fad4d0e4f88973818
Tuleap: #1283
parent e46fd0d9
...@@ -354,6 +354,13 @@ void RingClientUWP::RingD::deleteAccount(String ^ accountId) ...@@ -354,6 +354,13 @@ void RingClientUWP::RingD::deleteAccount(String ^ accountId)
tasksList_.push(task); tasksList_.push(task);
} }
void RingClientUWP::RingD::registerThisDevice(String ^ pin, String ^ archivePassword)
{
tasksList_.push(ref new RingD::Task(Request::RegisterDevice, pin, archivePassword));
archivePassword = "";
pin = "";
}
void void
RingClientUWP::RingD::startDaemon() RingClientUWP::RingD::startDaemon()
{ {
...@@ -649,13 +656,8 @@ RingClientUWP::RingD::startDaemon() ...@@ -649,13 +656,8 @@ RingClientUWP::RingD::startDaemon()
else { else {
switch (_startingStatus) { switch (_startingStatus) {
case StartingStatus::REGISTERING_ON_THIS_PC: case StartingStatus::REGISTERING_ON_THIS_PC:
{
tasksList_.push(ref new RingD::Task(Request::AddRingAccount));
break;
}
case StartingStatus::REGISTERING_THIS_DEVICE: case StartingStatus::REGISTERING_THIS_DEVICE:
{ {
tasksList_.push(ref new RingD::Task(Request::RegisterDevice, _pin, _password));
break; break;
} }
case StartingStatus::NORMAL: case StartingStatus::NORMAL:
...@@ -771,8 +773,8 @@ RingD::dequeueTasks() ...@@ -771,8 +773,8 @@ RingD::dequeueTasks()
break; break;
case Request::RegisterDevice: case Request::RegisterDevice:
{ {
auto pin = Utils::toString(_pin); auto pin = Utils::toString(task->_pin);
auto password = Utils::toString(_password); auto password = Utils::toString(task->_password);
std::map<std::string, std::string> deviceDetails; std::map<std::string, std::string> deviceDetails;
deviceDetails.insert(std::make_pair(DRing::Account::ConfProperties::TYPE, "RING")); deviceDetails.insert(std::make_pair(DRing::Account::ConfProperties::TYPE, "RING"));
......
...@@ -61,8 +61,6 @@ public: ...@@ -61,8 +61,6 @@ public:
} }
} }
property StartingStatus _startingStatus; property StartingStatus _startingStatus;
property String^ _pin; // you should RM ME
property String^ _password; // refatco : think a little... RM ME
void cancelOutGoingCall2(String^ callId); // marche void cancelOutGoingCall2(String^ callId); // marche
...@@ -100,10 +98,9 @@ internal: ...@@ -100,10 +98,9 @@ internal:
void eraseCacheFolder(); void eraseCacheFolder();
void updateAccount(String^ accountId); void updateAccount(String^ accountId);
void deleteAccount(String^ accountId); void deleteAccount(String^ accountId);
void registerThisDevice(String^ pin, String^ archivePassword);
/* TODO : move members */ /* TODO : move members */
///bool hasConfig; // replaced by startingStatus
std::string accountName; // YOU SHOULD RM ME
String ^ currentCallId; // to save ongoing call id during visibility change String ^ currentCallId; // to save ongoing call id during visibility change
/* events */ /* events */
......
...@@ -54,9 +54,13 @@ ...@@ -54,9 +54,13 @@
<TextBox x:Name="_aliasTextBox_" <TextBox x:Name="_aliasTextBox_"
Margin="10" Margin="10"
PlaceholderText="Enter your username"/> PlaceholderText="Enter your username"/>
<PasswordBox Margin="10" <PasswordBox x:Name="_password_"
Margin="10"
PasswordChanged="validatePassword"
PlaceholderText="Enter your password"/> PlaceholderText="Enter your password"/>
<PasswordBox Margin="10,10,10,20" <PasswordBox x:Name="_passwordCheck_"
Margin="10,10,10,20"
PasswordChanged="validatePassword"
PlaceholderText="Repeat your Password"/> PlaceholderText="Repeat your Password"/>
</StackPanel> </StackPanel>
<!-- SIP account. --> <!-- SIP account. -->
...@@ -81,6 +85,7 @@ ...@@ -81,6 +85,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Content="&#xE081;" Content="&#xE081;"
IsEnabled="False"
Click="_createAccountYes__Click" Click="_createAccountYes__Click"
Style="{StaticResource ButtonStyle2}"/> Style="{StaticResource ButtonStyle2}"/>
</StackPanel> </StackPanel>
......
...@@ -32,14 +32,12 @@ void ...@@ -32,14 +32,12 @@ void
Wizard::_createAccountYes__Click(Object^ sender, RoutedEventArgs^ e) Wizard::_createAccountYes__Click(Object^ sender, RoutedEventArgs^ e)
{ {
auto alias = _aliasTextBox_->Text; auto alias = _aliasTextBox_->Text;
if (alias->IsEmpty())
alias = "windows user";
std::wstring wstr(alias->Begin());
std::string str(wstr.begin(), wstr.end());
RingD::instance->_startingStatus = StartingStatus::REGISTERING_ON_THIS_PC; RingD::instance->_startingStatus = StartingStatus::REGISTERING_ON_THIS_PC;
RingD::instance->accountName = std::string(wstr.begin(), wstr.end());
this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([this] () { this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([this] () {
this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(RingClientUWP::MainPage::typeid)); this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(RingClientUWP::MainPage::typeid));
RingD::instance->createRINGAccount(_aliasTextBox_->Text, _password_->Password, true);
_password_->Password = "";
})); }));
} }
...@@ -118,11 +116,21 @@ Wizard::_avatarWebcamCaptureBtn__Click(Platform::Object^ sender, Windows::UI::Xa ...@@ -118,11 +116,21 @@ Wizard::_avatarWebcamCaptureBtn__Click(Platform::Object^ sender, Windows::UI::Xa
void RingClientUWP::Views::Wizard::_addAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) void RingClientUWP::Views::Wizard::_addAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{ {
RingD::instance->_pin = _PINTextBox_->Text;
RingD::instance->_password = _ArchivePassword_->Password;
RingD::instance->_startingStatus = StartingStatus::REGISTERING_THIS_DEVICE; RingD::instance->_startingStatus = StartingStatus::REGISTERING_THIS_DEVICE;
this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this]() { this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this]() {
this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(RingClientUWP::MainPage::typeid)); this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(RingClientUWP::MainPage::typeid));
RingD::instance->registerThisDevice(_PINTextBox_->Text, _ArchivePassword_->Password);
_ArchivePassword_->Password = "";
_PINTextBox_->Text = "";
})); }));
} }
void RingClientUWP::Views::Wizard::validatePassword(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
_createAccountYes_->IsEnabled = (_password_->Password
== _passwordCheck_->Password
&& _password_->Password->Length() > 0)
? true : false;
}
...@@ -17,6 +17,7 @@ private: ...@@ -17,6 +17,7 @@ private:
void _showAddAccountMenuBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void _showAddAccountMenuBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _avatarWebcamCaptureBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void _avatarWebcamCaptureBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _addAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void _addAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void validatePassword(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
}; };
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment